{% extends "base.volt" %}

{% block pageHeader %}
    {{ stylesheet_link("/libs/bootstrap-daterangepicker/daterangepicker.css", false) }}
<style>
    .tabs { display: none;}
    img { max-width:100%!important;}

</style>
{% endblock %}

{% block pageFooter%}
    <script type="text/javascript">
        var domainPic = '{{ this.di.get('appConfig').application.domainPic }}';
        var urlEditorPT = '{{ url.get('tools/editorPT') }}';
        var urlList = '{{ url.get('activity/list',['activity_state': info.activity_state]) }}';
    </script>
    {{ javascript_include("/assets/manage/js/editor_pt_view.js", false) }}
    {{ javascript_include("/libs/bootstrap-daterangepicker/moment.min.js", false) }}
    {{ javascript_include("/libs/bootstrap-daterangepicker/daterangepicker.js", false) }}
    
    <script type="text/javascript" charset="utf-8" src="/libs/UEditor/utf8-php/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/libs/UEditor/utf8-php/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="/libs/UEditor/utf8-php/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" charset="utf-8" src="/libs/UEditor/utf8-php/addCustomizeButton.js"></script>

    {{ javascript_include("/assets/manage/js/activity/update.js", false) }}
{% endblock %}

{% block content %}
    {{ partial("module/left_activity") }}
    <div class="col-xs-10">
        <ol class="breadcrumb">
            <li>活动管理</li>
            <li class="active">更新活动基础信息</li>
        </ol>

        <form id="form_update" class="form-horizontal" role="form" method="post" action="" target="ifr_send_file" enctype="multipart/form-data">
            <input type="hidden" name="callback" value="parent.setFormResult">
            <input type="hidden" name="activity_id" value="{{ info.activity_id }}">
            <div class="form-group">
                <label for="activity_title" class="col-xs-2 control-label">标题</label>
                <div class="col-xs-9">
                    <input type="text" class="form-control" id="activity_title" name="activity_title" data-rule="required;length[~15]" value="{{ info.activity_title|escape_attr }}">
                </div>
            </div>
            <div class="form-group">
                <label for="activity_cover" class="col-xs-2 control-label">封面</label>
                <div class="col-xs-9">
                    <div id="box_cover_show">
                        <img style="width:400px;height:200px;" src="{{ ActivityUrlBPCover(info.activity_cover, this.di) }}" />
                        <button type="button" class="btn btn-warning btn-xs but_update" id="but_cover_update"><i class="fa fa-pencil"></i></button>
                    </div>
                    <p id="imgInfo" class="help-block">*支持JPG，PNG，JPEG格式的图片，大小不超过1M，尺寸为：710X300px</p>
                    <!-- {%if info.posion_banner < 5%}
                    <p id="imgInfo" class="help-block">图片高宽都必须是：<em>750x220px</em>，大小不得超过2M</p>
                    {%endif%}
                    {%if info.posion_banner == 5%}
                    <p id="imgInfo" class="help-block">图片高宽都必须是：<em>360x390px</em>，大小不得超过2M</p>
                    {%endif%}
                    {%if info.posion_banner > 5%}
                    <p id="imgInfo" class="help-block">图片高宽都必须是：<em>360x190px</em>，大小不得超过2M</p>
                    {%endif%} -->
                    <div class="row hide" id="box_cover_update"></div>
                </div>
            </div>
            <div class="form-group">
                <label for="activity_title" class="col-xs-2 control-label">浏览量</label>
                <div class="col-xs-9">
                    <input type="text" class="form-control" id="views" name="views" value="{{ info.views }}" data-rule="required;integer[+0]">
                </div>
            </div>
            <div class="form-group">
                <label for="city_id" class="col-xs-2 control-label">城市</label>
                <div class="col-xs-2">
                {% if info.city_id == 0 %}
            		全国
            	{%else%}
            		{% for oc in openCity %}
            			{% if info.city_id == oc.city_id %}
            				{{oc.city_name}}
            			{%endif%}
            		{% endfor %}	
            	{%endif%}
                    <!-- <select class="form-control" id="city_id" name="city_id" data-rule="required;">
                        {% for oc in openCity %}
                            <option value="{{ oc.city_id }}" {{ info.city_id == oc.city_id ? 'selected="selected"' : '' }}>{{ oc.city_name|e }}</option>
                        {% endfor %}
                    </select> -->
                </div>
            </div>
            
           <!--  <div class="form-group">
                		<label  for="posion_banner" class="col-xs-2 control-label">广告位</label>
                		<div class="col-xs-3">
                			<select class="form-control" name="posion_banner" id="posion_banner">
                                <option value="0" {{ posion_banner == 0 ? 'selected="selected"' : '' }} >请选择</option>
                                {% for k, v in positionList %}
                                    <option value="{{ k }}" {{ info.posion_banner == k ? 'selected="selected"' : '' }} >{{ v }}</option>
                                {% endfor %}
                            </select>
                    	</div>
            	</div> -->
            	
            
            <!-- <div class="form-group">
                <label for="activity_cover" class="col-xs-2 control-label">活动周期</label>
                <div class="col-xs-5">
                    <input type="text" class="form-control" id="activity_time" name="activity_time" data-rule="required;" value="{{ info.activity_start_time }} 至  {{ info.activity_end_time }}">
                </div>
            </div> -->
            
            <div class="form-group">
            	<label for="activity_intro" class="col-xs-2 control-label">活动介绍</label>
                <div id="choose">
                	<input id="intro3" name="activity_type" type="radio" value="1" {{ 1 == info.activity_type ? 'checked="checked"' : '' }}>图文介绍
                    <input id="intro4" name="activity_type" type="radio" value="2" {{ 2 == info.activity_type ? 'checked="checked"' : '' }}>外链地址
                </div>

                <div class="choose-tab">

                    <div {{ info.activity_type == 1 ? 'class="col-xs-9 tabs show"' : 'class="col-xs-9 tabs"' }}>
                        <textarea id="editor" type="text" style="width:600px;height:300px;" name="activity_intro" id="activity_intro">
                            {{info.activity_intro}}
                        </textarea>
                    </div>

                    <div {{ info.activity_type == 2 ? 'class="col-xs-5 tabs show"' : 'class="col-xs-5 tabs"' }}>
                        <input type="text" class="form-control" value="{{info.out_link}}" id="out_link" name="out_link" >
                    </div>
                </div>

				

            
            	<!--
                <label for="activity_intro" class="col-xs-2 control-label">活动介绍</label>
                
                <div class="col-xs-9">
                    <div id="box_intro_view" class="hide"></div>
                    	<input type="hidden" class="form-control" id="activity_intro" name="activity_intro" data-rule="required;" data-target="#activity_intro_error" value="{{ info.activity_intro|escape_attr }}">
                    
                    <button type="button" class="btn btn-primary btn-sm hide" id="but_intro_add"><i class="fa fa-plus"></i> 添 加</button>
                    <button type="button" class="btn btn-primary btn-sm" id="but_intro_update"><i class="fa fa-pencil"></i> 修 改</button>
                    <div class="input-group" id="activity_intro_error"></div>
                </div>
                -->    
            </div>
            <!--外链地址-->
 <!--           {% if info.activity_type == '2' %}
            <div class="form-group">
                <label for="out_link" class="col-xs-2 control-label">外链地址</label>
                <div class="col-xs-5">
                    <input type="text" class="form-control" id="out_link" name="out_link" data-rule="required;" value="{{ info.out_link|escape_attr }}">
                </div>
            </div>
            {% endif %}
            -->
            <div class="form-group">
                <div class="col-xs-12 text-center">
                    <button type="submit" class="btn btn-primary"><i class="fa fa-floppy-o fa-lg"></i> 保 存</button>
                </div>
            </div>
        </form>
    </div>
{% endblock %}